<?php
namespace app\house\model;
use app\BaseModel;
use think\facade\Db;



class AdminPrice extends BaseModel
{
    //定义表名
    protected $name = 'longbing_card_house_price';

    /**
     * @param $dis
     * @return array
     * @throws \think\exception\DbException
     * 房产价格列表
     */
    public function PriceList($dis){
        $data = $this->where($dis)->order('sort desc')->select()->toArray();
        return $data;
    }
    /**
     * @param $dis
     * @return array
     * @throws \think\exception\DbException
     * 房产价格
     */
    public function priceSelect($dis){
        $data = $this->where($dis)->order('sort desc')->select()->toArray();
        return $data;
    }
    /**
     * @param $data
     * @return int|string
     * 添加房产价格
     */
    public function PriceAdd($data){
        $data['create_time'] = time();
        $data['update_time'] = time();
        $res = $this->insert($data);
        return $res;
    }


    /**
     * @param $dis
     * @param $data
     * @return AdminCate
     * 编辑房产价格
     */
    public function PriceUpdate($dis,$data){
        $data['update_time'] = time();
        $res = $this->where($dis)->update($data);
        return $res;

    }


    /**
     * @param $dis
     * @return AdminCate
     * 房产价格详情
     */
    public function PriceInfo($dis){
        $data = $this->where($dis)->find();
        return !empty($data)?$data->toArray():$data;
    }


    /**
     * @param $dis
     * @return bool
     * @throws \Exception
     * 删除房产价格
     */
    public function priceDel($dis){
        $res = $this->where($dis)->delete();
        return $res;

    }



}